<extend name="Public/index"/>
<block name="pageStatic">
    <link href="__CSS__/style.css" rel="stylesheet"/>
    <script src="__JS__/jquery-1.10.1.min.js"></script>
    <script src="__JS__/scrolltopcontrol.js"></script>
    <script src="__JS__/navigation.js"></script>
    <script src="__JSPLUGINS__/layer/layer.js"></script>
    <style>
	    .pagecon   {
		    padding:1em;
		    font-size:16px;
	    }
        .tb3{
            padding-left: 1.5em;
            background: url(/Public/Home/images/tb2.gif) no-repeat left center;
            background-size: 1.3em auto;
        }
		/*.pagecon img { max-width:288px;}*/
		/*.pagecon p { font-size:1.4em; margin-bottom:1em}*/
		.pagecon p{overflow: hidden; }
    </style>
</block>
<block name="pageHeader">
    <include file="Public/header.info" />
</block>
<block name="pageContent">
    <div class="detailed">
        <div class="pagenew-stit">
            <h3>{$info.title}</h3>
            <h4 class="collection">{$info.create_time|time_format}<span>{$info.source}</span><a class="tb3" href="javascript:;" article-id="{$info.id}" style="font-size: 10px; margin-left:10px;<if condition='$msg eq "已收藏"'>background:url('/Public/Home/images/tb2-on.png') no-repeat left center;</if>">{$msg}</a></h4>
        </div>
        <div class="pagecon">
            {$info.content}
        </div>
        <!--<div class="newsmore">-->
            <!--<ul>-->
                <!--<notempty name="prev">-->
                <!--<li>上一篇：<a href="{:U('Article/detail', array('id'=>$prev['id']))}">{$prev.title}</a></li>-->
                <!--</notempty>-->
                <!--<noempty name="next">-->
                <!--<li>下一篇：<a href="{:U('Article/detail', array('id'=>$next['id']))}">{$next.title}</a></li>-->
                <!--</noempty>-->
            <!--</ul>-->
        <!--</div>-->
        <!-- 分享
        <div class="party">
            <ul>
                <li><a class="weChat" href="#">微信好友</a></li>
                <li><a class="friends" href="#">微信朋友圈</a></li>
                <li><a class="sina" href="#">新浪微博</a></li>
                <li><a class="qq" href="#">QQ好友</a></li>
            </ul>
        </div> -->
    </div>
    <div class="list-box">
        <h5 class="generic">相关新闻</h5>
        <ul>
            <volist name="correlationList" id="vo">
            <li>
                <div class="list-pic"><a href="{:U('Article/detail', array('id'=>$vo['id']))}"><img src="{$vo.cover_id|get_cover='path'}" ></a></div>
                <div class="list-con">
                    <h5><a href="{:U('Article/detail', array('id'=>$vo['id']))}">{$vo.title}</a></h5>
                    <p><a href="{:U('Article/detail', array('id'=>$vo['id']))}">{$vo.description}</a></p>
<!--                     <div class="time">{$vo.create_time|time_format} <a href="javascript:;">{$vo.source}</a></div> -->
                    <div class="collection"><!-- <a class="tb1" href="javascript:;">215</a> --> <a class="tb2" href="javascript:;" article-id="{$vo.id}">{$vo.bookmark}</a></div>
                </div>
            </li>
            </volist>
        </ul>
        <div class="button-btn"><a href="{:U('Category/lists', array('cateid'=>$cate['id']))}">进入频道页</a> </div>
    </div>
    <script>
        $(function () {
            var img=$('.pagecon  img');
            img.each(function () {
                if(parseInt($(this).css('width'))>330){
                    $(this).attr({
                        width:'100%',
                        height:"auto"
                    });
                }
                console.log(img.parent().css("text-align","center"));
            });
        })
        $(".tb3").click(function () {
            var _this = $(this);
            $article_id = $(this).attr('article-id');
            var data = {};
            data['article_id'] = $article_id;
            $.ajax({
                type: "POST",
                url: "{:U('Article/ajaxAddCollect')}",
                data: data,
                dataType: "json",
                success:function(result){
                    //console.log(result);
                    if(result && result.error==0){

                        _this.html("已收藏");
                        _this.css("background","url('/Public/Home/images/tb2-on.png') no-repeat left center");
                        layer.msg(result.msg);
                    }else if(result && result.error==-1){
                        window.location.href=result.url;
                    }else if(result && result.error==-2){
                        _this.html("收藏");
                        _this.css({"background":"url('/Public/Home/images/tb2.gif') no-repeat left center","background-size":"1.3em auto"});
                        layer.msg(result.msg);
                    } else if(result.msg){
                        layer.msg(result.msg);
                    }else{
                        layer.msg('网络异常, 请稍后尝试!');
                    }
                }

            });
        })
    </script>
</block>